package com.vadmin.vadminjava.servlet;


import com.alibaba.fastjson.JSONObject;
import com.vadmin.vadminjava.service.FinanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/******************************************************************************************
 *
 * 后台管理的财务相关接口
 *
 *****************************************************************************************/

@RestController
@RequestMapping ("/AdminFinanceServlet")
public class AdminFinanceServlet {

    @Autowired
    FinanceService financeService;

    //用户资金明细列表
    @RequestMapping(value = {"/userMoneyLog"})
    public String userMoneyLog(@RequestParam Map<String, Object> params,HttpServletRequest httpServletRequest) {
        JSONObject paramJ = new JSONObject();
        params.keySet().forEach(i -> paramJ.put(i, params.get(i)));
        return financeService.userMoneyLog(paramJ).toJSONString();
    }


    //
    //用户资金结算处理
    @RequestMapping(value = {"/userMoneySettle"})
    public String userMoneySettle(@RequestParam Map<String, Object> params,HttpServletRequest httpServletRequest) {
        JSONObject paramJ = new JSONObject();
        params.keySet().forEach(i -> paramJ.put(i, params.get(i)));
        return financeService.userMoneySettle(paramJ).toJSONString();
    }



}
